import React from 'react';
import { TjTable } from '@/pages/ETrade/components';

const unitStyle = { color: 'rgba(255, 255, 255, 0.6)', fontSize: 12, lineHeight: '20px' };
export const CompanyTable = ({ loading, dataSource = [] }) => {
  // const [openKeys, onChangeOpenKeys] = useState([1])

  const columns = [
    {
      name: '',
      width: 106,
      code: 'stationName',
    },
    {
      code: 'stationCapacity',
      name: (
        <div>
          装机容量
          <div style={unitStyle}>(万千瓦)</div>
        </div>
      ),
    },
    {
      code: 'totalOngridQuantity',
      name: (
        <div>
          总上网电量
          <div style={unitStyle}>(万千瓦时)</div>
        </div>
      ),
    },
    {
      code: 'ongridTaxPrice',
      width: 112,
      name: (
        <div>
          上网电价(含税)
          <div style={unitStyle}>(元/MWh)</div>
        </div>
      ),
    },
    {
      code: 'longTermContractQuantity',
      width: 100,
      name: (
        <div>
          中长期合约电量
          <div style={unitStyle}>(万千瓦时)</div>
        </div>
      ),
    },
    {
      code: 'longTermContractPrice',
      width: 100,
      name: (
        <div>
          中长期合约电价
          <div style={unitStyle}>(元/MWh)</div>
        </div>
      ),
    },
    {
      code: 'provincialDayaheadQuantity',
      name: (
        <div>
          省内日前电量
          <div style={unitStyle}>(万千瓦时)</div>
        </div>
      ),
    },
    {
      code: 'provincialDayaheadAveragePrice',
      name: (
        <div>
          省内日前均价
          <div style={unitStyle}>(元/MWh)</div>
        </div>
      ),
    },
    {
      code: 'provincialRealtimeQuantity',
      name: (
        <div>
          省内实时电量
          <div style={unitStyle}>(万千瓦时)</div>
        </div>
      ),
    },
    {
      code: 'provincialRealtimeAveragePrice',
      name: (
        <div>
          省内实时均价
          <div style={unitStyle}>(元/MWh)</div>
        </div>
      ),
    },
    {
      code: 'provincialInterDayaheadQuantity',
      name: (
        <div>
          省间日前电量
          <div style={unitStyle}>(万千瓦时)</div>
        </div>
      ),
    },
    {
      code: 'provincialInterDayaheadAveragePrice',
      name: (
        <div>
          省间日前均价
          <div style={unitStyle}>(元/MWh)</div>
        </div>
      ),
    },
    {
      code: 'provincialInterIntradayQuantity',
      name: (
        <div>
          省间实时电量
          <div style={unitStyle}>(万千瓦时)</div>
        </div>
      ),
    },
    {
      code: 'provincialInterIntradayAveragePrice',
      name: (
        <div>
          省间实时均价
          <div style={unitStyle}>(元/MWh)</div>
        </div>
      ),
    },
    {
      code: 'otherRevenue',
      name: (
        <div>
          其他收入
          <div style={unitStyle}>(万元)</div>
        </div>
      ),
    },
    {
      code: 'ongridTaxExclusivePrice',
      name: (
        <div>
          上网电价(不含税)
          <div style={unitStyle}>(元/MWh)</div>
        </div>
      ),
      width: 127,
    },
    {
      code: 'variableCostTaxExclusive',
      name: (
        <div>
          变动成本(不含税)
          <div style={unitStyle}>(元/MWh)</div>
        </div>
      ),
      width: 127,
    },
  ];

  return (
    <TjTable
      isLoading={loading}
      dataSource={dataSource}
      columns={columns.map((i) => ({ ...i, align: 'center', width: 117 }))}
      primaryKey={'id'}
    />
  );
};
